<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>飞特运动管理平台</title>
    <script src="../../res/js/jquery-3.4.1.min.js"></script>
    <script src="../../../res/js/login_common.js"></script>


    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <link id="layuicss-layer" rel="stylesheet" href="./css/layer.css" media="all">
    <link rel="stylesheet" href="../../layui/css/layui.css">
    <script src="../../layui/layui.js"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>

</head>
<body>
<!-- 顶部开始 -->
<div class="container">
    <div class="logo"><a href="#">飞特运动管理平台</a></div>
    <div class="left_open">
        <i title="展开左侧栏" class="iconfont"></i>
    </div>

    <ul style="position: relative;top:-10px;" class="layui-nav right" lay-filter="">
        <li class="layui-nav-item" lay-unselect="">
        <a href="javascript:;" id="renwu"><img src="" class="layui-nav-img">未登录</a>
        <dl class="layui-nav-child">
            <dd id="dd" ><a onclick="xiugai()">修改密码</a></dd>

            <dd><a onclick="tuichu()">退出登录</a></dd>
        </dl>
    </li>
       </ul>

</div>
<!-- 顶部结束 -->
<!-- 中部开始 -->
<!-- 左侧菜单开始 -->
<div class="left-nav" style="overflow:auto;">
    <div id="side-nav">
        <ul id="nav">
            <li>

            </li>
        </ul>
    </div>
</div>
<!-- <div class="x-slide_left"></div> -->
<!-- 左侧菜单结束 -->
<!-- 右侧主体开始 -->
<div class="page-content">
    <div class="layui-tab tab" lay-filter="xbs_tab" lay-allowclose="false">
        <ul class="layui-tab-title " id="qwe">

          </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item" style="display: block">
                <iframe src="../../../pages/cy/AttachmentHomePage.html" id="demoAdmin" frameborder="0" scrolling="yes" class="x-iframe"></iframe>
            </div>
           </div>
    </div>
</div>
<div hidden id="jie" style="z-index: 99; width: 400px;height: 300px;position: fixed;left:40%;top:40%;background: #fff;">
    <form  class="layui-form" action="" style="margin-top: 20px;margin-right: 20px;">
        <input name="usid" id="usid" hidden>
        <div class="layui-form-item">
            <label class="layui-form-label">输入旧密码</label>
            <div class="layui-input-block">
                <input type="password" name="password1" placeholder="请输入密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">输入新密码</label>
            <div class="layui-input-block">
                <input type="password" name="password2" placeholder="请输入密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">再次输入</label>
            <div class="layui-input-block">
                <input type="password" name="password3" placeholder="请输入密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                <button type="button" class="layui-btn" id="but">取消</button>
            </div>
        </div>
    </form>
</div>
<div class="page-content-bg"></div>
<script type="text/javascript" >
    layui.use(['element','form','layer'], function() {
var layer=layui.layer;
        var form=layui.form;
        var element = layui.element;
        var url="../../../ModuleAction/find";
        var data={usId:window.loginObj.manager.usId};

        $.post(url,data,function(obj){

            $.each(obj,function(index,item){
                var str='<li class="bvdf">\n' +
                    '                <a  onclick=dianji(this)>\n' +
                    '                    <cite>'+item.name+'</cite>\n' +
                    '                </a>\n' +
                    '                <ul class="sub-menu">';

                $.each(item.list,function(index,item1){
                    str+='  <li><a name="'+item1.url+'" onclick=zhuan(this)><cite>'+item1.name+'</cite></a></li>';
                })
                str+='</ul></li>';
                $("#nav").append(str);
            })
            // $(".bvdf").hide();
        },"json")

        element.init();
        $("#renwu").html('<img src="../../../'+loginObj.manager.usPhoto+'" class="layui-nav-img">'+loginObj.manager.usName);
        $("#but").click(function(){
            $("#jie").hide();
            $("#jie input").val("");
        })
        $("body").click(function(){
            $("#dd").removeClass('layui-this')
        })
        form.on('submit(demo1)', function(data){

            var url="../../../UserAction/gai";
            $.post(url,data.field,function(obj){
                if(obj.num==1){
                    layer.msg(obj.msg, {
                        icon: 1,
                        time: 2000 //2秒关闭（如果不配置，默认是3秒）
                    }, function(){

                    });


                }else {
                    layer.msg(obj.msg, {
                        icon: 2,
                        time: 2000 //2秒关闭（如果不配置，默认是3秒）
                    }, function () {
                        tuichu();
                    });
                }
            },"json")
            return false;
        });
    });


    function dianji(obj){

        $(obj).parent().find("ul").toggle(100);
    }
    function xiugai() {

        $("#jie").show();
    $("#usid").val(loginObj.manager.usId);
    }

    function tuichu(){
        var url="../../../UserAction/unLogin";
        var data=null;

        $.post(url,data,function(obj){
            location.href="../index.html";
        })
    }
    function getQueryStringOne(key) {
        var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null)
            return decodeURI(r[2]);
        return null;
    }

    function zhuan2(obj){

        $("#demoAdmin").prop("src",obj);
    }
    function dele(obj) {

        var i=0;
        var src="";
        $(obj).parent().remove();
        $(".home").each(function(index,item){

            src=$(item).find("input").val();
            i=i+1;
        })

        if(i==0) {

            $("#demoAdmin").prop("src","../../../pages/cy/AttachmentHomePage.html");
        }else{
            $("#demoAdmin").prop("src",src);
        }
    }
    function zhuan(obj){
        var i=0;
        $("#demoAdmin").prop("src",$(obj).prop("name"));
        var attachState = $(obj).prop('attachState');
        var as = '';
        if (attachState === null || attachState === undefined || attachState === ''){
            as=  $(obj).parent().find("cite").text();
        }else if (attachState === '1'){
            as = $(obj).prop('attachType');
        }

        $(".home span").each(function(index,item){

            if(as===$(item).text()){
                i=3;
            }
        })

        if(i==0) {
            $("#qwe").append(' <li class="home" >&nbsp;&nbsp;<input value="' + $(obj).prop("name") + '" hidden><span  onclick=zhuan2("' + $(obj).prop("name") + '")>' + as +'</span>&nbsp;&nbsp;<i onclick=dele(this) class="layui-icon layui-icon-close" style="font-size: 10px;"></i> </li>')
        }
    }
    </script>
</body>
</html><SCRIPT ></SCRIPT>